<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//FR"
   "http://www.w3.org/TR/html4/strict.dtd"> 
<html lang="fr">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <title>Export PDF</title>
        <style type="text/css" media="all">
            table, tr, td{
                border-collapse: collapse;
                border: solid 1px #000;
            }
            table thead tr{
                background: #0099ff;
                text-align: center;
                font-weight: bolder;
            }
        </style>
    </head>
    <?php if(!isset($_POST['print'])): ?>
    <button class="btn btn-primary" id="printer">Imprimer</button>
    <?php endif; ?>
    <body id="to-print">
        <p>
            Export PDF
        </p>
        <table>
            <thead>
                <tr>
                    <td>Title</td>
                    <td>Value</td>
                </tr>
            </thead>
            <tbody>
                <?php for($i = 0; $i < 10; $i++): ?>
                <?php $color = rand(555, 999); ?>
                <tr style="text-align: center; background: #<?php echo $color; ?>">
                    <td>Value <?php echo $i + 1 ?></td>
                    <td><?php echo rand(0, 100); ?></td>
                </tr>
                <?php endfor; ?>
            </tbody>
        </table>
    </body>
</html>

